package com.cskaoyan.shopping.service.remote;

import com.cskaoyan.mall.api.OrderProductService;
import com.cskaoyan.mall.dto.ClearCartItemRequest;
import com.cskaoyan.mall.dto.ClearCartItemResponse;
import com.cskaoyan.shopping.service.ICartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @auther cskaoyan
 * @date 2022/5/18:10:21
 */
@RestController
public class OrderProductServiceImpl implements OrderProductService {


    @Autowired
    ICartService iCartService;

    /**
     * 清空指定用户的购物车缓存(用户下完订单之后清理）
     */
    @RequestMapping(value = "/rpc/items", method = RequestMethod.DELETE)
    @Override
    public ClearCartItemResponse clearCartItemByUserID(@RequestBody ClearCartItemRequest request) {
        ClearCartItemResponse clearCartItemResponse = iCartService.clearCartItemByUserID(request);
        return clearCartItemResponse;
    }
}
